import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    meta: { title: '珠宝商城' },
    component: function () {
      return import('../views/goods/index.vue')
    }
  },
  {
    path: '/search',
    name: 'search',
    component: function () {
      return import('../views/search/index.vue')
    }
  },{
    path: '/list',
    name: 'list',
    component: function () {
      return import('../views/goods/list.vue')
    }
  },
  {
    path: '/category',
    name: 'category',
    component: function () {
      return import('../views/goods/category.vue')
    }
  },
  {
    path: '/spike/list',
    name: 'spikelist',
    meta: { title: "秒杀列表"},
    component: function () {
      return import('../views/goods/spike.vue')
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    meta: { title: "商品详情"},
    component: function () {
      return import('../views/goods/detail.vue')
    }
  },
  {
    path: '/order/:id',
    name: 'order',
    meta: { title: "确认订单"},
    component: function () {
      return import('../views/goods/order.vue')
    }
  },
  {
    path: '/user/index',
    name: 'user_index',
    meta: { title: "个人中心"},
    component: function () {
      return import('../views/user/center.vue')
    }
  },
  {
    path: '/user/center',
    name: 'user_center',
    meta: {
      title: "我的",
    },
    component: function () {
      return import('../views/user/center.vue')
    }
  },
  {
    path: '/user/orderlist',
    name: 'order_list',
    meta: { title: "订单列表"},
    component: function () {
      return import('../views/user/orderlist.vue')
    }
  },
  {
    path: '/order/detail/:orderId',
    name: 'order_list',
    meta: { title: "订单明细"},
    component: function () {
      return import('../views/user/orderDetail.vue')
    }
  },
  {
    path: "/shipping/:orderId",
    name: "shipping",
    meta: { title: "物流信息"},
    component: function() {
      return import("../views/user/shipping.vue");
    }
  },
  {
    path: '/address/list',
    name: 'address_list',
    meta: { title: "地址管理"},
    component: function () {
      return import('../views/user/addrlist.vue')
    }
  },
  {
    path: '/address/add',
    name: 'address_add',
    meta: { title: "添加地址"},
    component: function () {
      return import('../views/user/addrAdd.vue')
    }
  },
  {
    path: '/address/edit/:id',
    name: 'address_edit',
    meta: { title: "编辑地址"},
    component: function () {
      return import('../views/user/addrEdit.vue')
    }
  },
  {
    path: '/user/sharing',
    name: 'user_share',
    meta: { title: '我的二维码' },
    component: function () {
      return import('../views/user/share.vue')
    }
  },
  {
    path: '/invite/record',
    name: 'invite_record',
    meta: { title: '我的邀请' },
    component: function () {
      return import('../views/user/inviteRecord.vue')
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
